﻿// Inner Fire 游戏引擎库
// Lua绑定适配项目
//
// Copyright (c) 2025 by 尔西大帝. All rights reserved.
//
// 所属层级：应用层(4)
// 用于Controller的Lua绑定适配。
//
// Author: 尔西大帝
// Email: 2670613871@qq.com
// Created: 2025-04-30

#include "lua_manager.h"
#include <functional>
#include <game/animation/animation_blend.h>
#include <game/controller/chara_animation.h>

using namespace ikit;

namespace ifire::game {


static int CharaAnimation_GetData(lua_State* L) {
  auto self = L_THIS(CharaAnimation);
  return self->GetData(L);
}

static int CharaAnimation_GetLocomotion(lua_State* L) {
  auto self = L_THIS(CharaAnimation);
  auto item = self->GetLocomotion();
  return ikit::lua_return_object(L, item, "AnimationBlendMeta");
}

void register_lua_controller(lua_State* L, LuaManager* lua_manager) {
  // 注册CharaAnimation
  luaL_Reg chara_animation_methods[] = {               //
      {"GetLocomotion", CharaAnimation_GetLocomotion}, //
      {"GetData", CharaAnimation_GetData},             //
      {NULL, NULL}};
  ikit::lua_register_metatable(
      L, "CharaAnimationMeta", chara_animation_methods);
}

} // namespace ifire::game